package com.onlineMIS.ORM.DAO.headQ.supplier.finance;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.onlineMIS.ORM.DAO.BaseDAO;
import com.onlineMIS.ORM.entity.headQ.finance.FinanceBillItem;
import com.onlineMIS.ORM.entity.headQ.supplier.finance.FinanceBillSupplier;

@Repository
public class FinanceBillSupplierDaoImpl extends BaseDAO<FinanceBillSupplier> {
	
	public void initialize(FinanceBillSupplier financeBill){
	      this.getHibernateTemplate().initialize(financeBill.getFinanceBillItemSet());
	}

	public List<FinanceBillSupplier> getAllByCardId(int cardId, boolean b) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceBillSupplier.class);
		criteria.add(Restrictions.eq("financeCategory.id", cardId));
		List<FinanceBillSupplier> fBillItems =  getByCritera(criteria, true);
		return fBillItems;
	}

}
